﻿@model Bricks.Site.Models.QualityCorrectiveView

@{
    ViewBag.Title = "编辑质量整改";
    Layout = "~/Views/Shared/_UserPage.cshtml";
}

@*引入uEditor*@
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.all.js"> </script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/lang/zh-cn/zh-cn.js"></script>
<link rel="stylesheet" type="text/css" href="/Res/ueditor/themes/default/css/ueditor.css" />

<script>
    $(function () {
        $.MiniUEditorInit($("#hID").val(), "QualityManagement/QualityCorrective/Content", "content", 620, 100);  //迷你加载
        $.MiniUEditorInit($("#hID").val(), "QualityManagement/QualityCorrective/FinishCondition", "finishCondition", 620, 100);  //迷你加载
    });

    var Edit = {
        //选择标段
        ChooseQualityCircular: function () {
            //$("#tempCorrectiveSectionIDs").val($("#correctiveSectionIDs").val());  //弹出的时候，将correctiveSectionIDs赋值给tempCorrectiveSectionIDs

            Edit.ChooseMutual("选择标段", "/QualityCircular/ChooseCircular", true);
        },

        ChooseMutual: function (title, href, isAdd) {
            $.ModelDialog({
                title: title, href: href, width: 750,
                handler: function () {
                    $.ModelForm({
                        validate: true, button: $(this),
                        id: "#circular-model",
                        url: "/QualityCircular/ChooseCircularPost",
                        success: function (result) {
                            var checkedItems = $('#qualityCircularDataGrid').datagrid('getChecked');
                            //var names = [];
                            //$.each(checkedItems, function (index, item) {
                            //    names.push(item.CircularName);
                            //});
                            //$.EasyuiSlide(names.join(","));

                            //单选
                            if (checkedItems.length == 1) {
                                $("#hCircularID").val(checkedItems[0].ID);
                                $("#correctiveDemand").val(checkedItems[0].CircularName);

                                //将选择的通报内容赋给整改
                                //$("#content").val(checkedItems[0].Content);
                                //ueditor需要用这种方式来赋值
                                var editor = UE.getEditor('content');
                                editor.setContent(checkedItems[0].Content);
                            }
                        }
                    });
                },
                onLoad: function () {
                    //Circular.FormInit(isAdd);
                }
            });
        }
    }
</script>

<div class="frombox datagrid-body" style="padding-bottom: 5px;">
    <form id="circular-model" method="post">
        <table class="datagrid-btable" border="0" cellspacing="0" cellpadding="0">
            <tr class="datagrid-row">
                <td class="th">
                    <div class="datagrid-cell">整改要求</div>
                </td>
                <td class="td" colspan="9">
                    <div class="datagrid-cell">
                        <input id="correctiveDemand" name="CorrectiveDemand" class="easyui-textbox" data-options="required:true" style="width:528px;" value="@Model.CorrectiveDemand" />
                        <a id="chooseCircular" href='javascript:void(0)' class='easyui-linkbutton' onclick='Edit.ChooseQualityCircular()' data-options='plain:true,iconCls:"icon-bell"'>选择通报</a>
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th">
                    <div class="datagrid-cell">整改标题</div>
                </td>
                <td class="td" colspan="9">
                    <div class="datagrid-cell">
                        <input name="CorrectiveTitle" class="easyui-textbox" data-options="required:true" style="width: 615px;" value="@Model.CorrectiveTitle" />
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th">
                    <div class="datagrid-cell">填报时间</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        <input name="FormTime" class="easyui-textbox" value="@Model.FormTime" style="background:#eeeeee;" readonly />
                    </div>
                </td>
                <td class="rth">
                    <div class="datagrid-cell">填报单位</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        @*<input id="publishOrg" name="PublishOrg" class="easyui-textbox" value="@Model.PublishOrg" style="background:#eeeeee;" readonly />*@
                        <input id="formOrgID" name="FormOrgID" class="easyui-textbox" value="@Model.FormOrgID" />
                    </div>
                </td>
                <td class="rth">
                    <div class="datagrid-cell">填报人</div>
                </td>
                <td class="td">
                    <div class="datagrid-cell">
                        <input name="FormUser" class="easyui-textbox" style="background:#eeeeee;" value="@Model.FormUser" readonly />
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th">
                    <div class="datagrid-cell">整改内容</div>
                </td>
                <td class="td" colspan="9">
                    <div class="datagrid-cell">
                        <textarea id="content" name="Content" cols="85" rows="5">@Model.Content</textarea>
                    </div>
                </td>
            </tr>
            <tr class="datagrid-row">
                <td class="th">
                    <div class="datagrid-cell">完成情况</div>
                </td>
                <td class="td" colspan="9">
                    <div class="datagrid-cell">
                        <textarea id="finishCondition" name="FinishCondition" cols="85" rows="5">@Model.FinishCondition</textarea>
                    </div>
                </td>
            </tr>
        </table>
        <input id="hID" name="ID" type="hidden" value="@Model.ID" />
        <input id="hFormUserID" name="FormUserID" type="hidden" value="@Model.FormUserID" />
        <input id="hCircularID" name="CircularID" type="hidden" value="@Model.CircularID" />
        <input name="IsDeleted" type="hidden" value="@Model.IsDeleted" />
        <input name="AddDate" type="hidden" value="@Model.AddDate" />
    </form>
</div>
